(deftemplate intrebare
    (slot stringIntrebare)
    (slot raspuns)
    )
(assert (intrebare (stringIntrebare nil)(raspuns nil)))
(defrule q1
	(intrebare (stringIntrebare nil)(raspuns nil))
	=>
	(printout t "Sunteti angajat ? (DA/NU)" crlf)
	(bind ?r (read))
	(assert (intrebare (stringIntrebare "Sunteti angajat")(raspuns ?r)))
	)
(defrule q2
	(intrebare (stringIntrebare "Sunteti angajat")(raspuns DA))
	=>
	(printout t "Mai aveti credite ? (DA/NU)" crlf)
	(bind ?r (read))
	(assert (intrebare (stringIntrebare "Mai aveti credite")(raspuns ?r)))
	)
(defrule q3
    (intrebare(stringIntrebare "Mai aveti credite")(raspuns NU))
    =>
    (printout t "Varsta ?" crlf)
    (bind ?r (read))
    (assert (intrebare(stringIntrebare "Varsta")(raspuns ?r)))
    )
(defrule q4
    (intrebare(stringIntrebare "Varsta")(raspuns ?r & : (> ?r 21) & : (< ?r 50)))
    =>
    (printout t "Salariu ?" crlf)
    (bind ?r (read))
    (assert(intrebare(stringIntrebare "Salariu")(raspuns ?r)))
    )
(defrule q5
    (intrebare(stringIntrebare "Salariu")(raspuns ?r &:(> ?r 1500)&:(< ?r 2000)))
    =>
    (printout t "E nevoie de mai multe informatii pentru a primi un credit" crlf)
    )
(defrule q6
    (intrebare(stringIntrebare "Salariu")(raspuns ?r &:(>= ?r 2000)))
    =>
    (printout t "Creditul a fost aprobat!" crlf)
    )
(run)
(facts)
